<?php
require_once "includes/config.php";
require_once "includes/functions.php";
session_start();
$sessid=session_id();
$amount=0;
$sqlCart="select * from tempcart tt  where tt.session_id='".$sessid."'";
$resCart=mysql_query($sqlCart);
$rowCart=mysql_num_rows($resCart);
while($rows=mysql_fetch_array($resCart))
{
$amount=$rows['qty']*$rows['itemamt']+$amount;
}
$comm=$amount*8.25/100;
$amount=number_format($amount+$comm+$_SESSION['shipping'],2);

$sqlprofile="select * from tbl_users where user_id='".$_SESSION['user_id_sess']."'";
$resprofile=mysql_query($sqlprofile);
$rowprofile=mysql_fetch_array($resprofile);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Swapen.com - Buy and Sell</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color:#fefefe; font-size:12px; font-family: "Trebuchet MS"; background-color:#000000;}
.style3 {font-size:14px; color: #4a4a4a; font-family: "Trebuchet MS";}
-->
</style>

</head>

<body>
<div align="center" class="style1"><span class="style2">Please wait, you are being redirected to selected payment gateway</span><span class="style3">.</span></div>
<form method="post" name="paypal_form" action="https://www.paypal.com/cgi-bin/webscr">
                                        <input type="hidden" name="business" value="swapen@iceincorp.com" />
                                        <input type="hidden" name="cmd" value="_xclick" />
                                        <!-- the next three need to be created -->
                                        
                                        <input type="hidden" name="return" value="http://www.swapen.com/index.php?process=yes" />
                                        <input type="hidden" name="cancel_return" value="http://www.swapen.com/index.php?cancelled=yes" />
                                        <input type="hidden" name="notify_url" value="http://www.swapen.com/index.php?process=yes" />
                                        <input type="hidden" name="rm" value="2" />
                                        <input type="hidden" name="currency_code" value="USD" />
                                        <input type="hidden" name="lc" value="US" />
                                        <input type="hidden" name="bn" value="toolkit-php" />
                                        <input type="hidden" name="cbt" value="Continue" />
                                        <!-- Payment Page Information -->
                                        <input type="hidden" name="no_shipping" value="" />
                                        <input type="hidden" name="no_note" value="1" />
                                        <input type="hidden" name="cn" value="Comments" />
                                        <input type="hidden" name="cs" value="" />
							                              
                                        <!-- Product Information -->
                                        <input type="hidden" name="item_name" value="Swapen" />
                                        <input type="hidden" name="item_number" value="" />
                                        <input type="hidden" name="undefined_quantity" value="" />
                                        <input type="hidden" name="on0" value="Order ID" />
                                        <input type="hidden" name="os0" value="<?php echo $sessid;?>" />
                                   		<input type="hidden" name="amount" value="<?php echo number_format($amount,2);?>" />  
                                        <!-- Shipping and Misc Information -->
                                        <input type="hidden" name="shipping" value="" />
                                        <input type="hidden" name="shipping2" value="" />
                                        <input type="hidden" name="handling" value="" />
                                        <input type="hidden" name="tax" value="" />
                                        <input type="hidden" name="custom" value="" />
                                        <input type="hidden" name="invoice" value="" />
                                        <!-- Customer Information -->
                                        <input type="hidden" name="first_name" value="<?php echo $rowprofile['first_name'];?>" />
                                        <input type="hidden" name="last_name" value="<?php echo $rowprofile['last_name'];?>" />
                                        <input type="hidden" name="address1" value="<?php echo $rowprofile['address_line_1'];?>" />
                                        <input type="hidden" name="address2" value="" />
                                        <input type="hidden" name="city" value="<?php echo $rowprofile['city'];?>" />
                                        <input type="hidden" name="state" value="<?php echo $rowprofile['state'];?>" />
                                        <input type="hidden" name="zip" value="<?php echo $rowprofile['zip'];?>" />
                                        <input type="hidden" name="email" value="<?php echo $rowprofile['email'];?>" />
                                        
                                        </noscript>
</form>
									<script language="javascript1.2">
document.paypal_form.submit();
</script>
</body>
</html>
